#include <Ape/IO/Console.h>
#include <Ape/String.h>

#define APE__WRITE_STD_OUT_HEAVY_HACK

namespace Ape {
	namespace IO {
	
		void WriteStdOut (const Object& o) {
			const String& s = o.ToString();
			const wchar_t* wcs = s.ToWChars();
#ifdef APE__WRITE_STD_OUT_HEAVY_HACK
			size_t count = s.get_Length();
			for (size_t i = 0; i < count; i++) {
				printf ("%lc", wcs[i]);
			}
#else
			printf ("%ls\n", wcs);
#endif
		}
		void WriteStdErr (const Object& o) {
#ifdef APE__WRITE_STD_OUT_HEAVY_HACK
			printf ("! ");
			StdOut << o;
			printf ("\n");
#else
			printf ("! %ls\n", o.ToString().ToWChars() );
#endif
		}
		
	}
}
